#pragma once 
#include<iostream>
#include<unistd.h>
#include<fcntl.h>


void SetNonBlockOrDie(int sock)
{
    int f1 = fcntl(sock, F_GETFL);
    if(f1<0)
    {
        std::cout<<"Warning SetNonBlockOrDie error"<<std::endl;
        exit(-1);
    }
    fcntl(sock, F_SETFL, f1 | O_NONBLOCK);
}